/*
 * Copyright (c) 2020 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
*/

#ifndef OHOS_MAIN_ABILITY_SLICE_H
#define OHOS_MAIN_ABILITY_SLICE_H

#include "ability_loader.h"
#include "event_listener.h"
#include "components/ui_image_view.h"
#include "components/ui_swipe_view.h"
#include "components/ui_label_button.h"
#include "components/ui_label.h"
#include "layout/grid_layout.h"
#include "securec.h"

namespace OHOS {
class mySwipeListener : public UISwipeView::OnSwipeListener{
public: 
    mySwipeListener(UISwipeView* swipe,UILabel* label):
    swipe_(swipe),label_(label){};
    ~mySwipeListener() {};
    virtual void OnSwipe(UISwipeView &view) override
    {
        char buf[10] = {0};
        // sprintf_s(buf,sizeof(buf),".%d.",swipe_->GetCurrentPage() + 1);
        switch(swipe_->GetCurrentPage())
        {
            case 0:label_->SetText("当前模式：基础模式");break;
            case 1:label_->SetText("当前模式：第二种模式");break;
            case 2:label_->SetText("当前模式：第三种模式");break;
            default:
                label_->SetText("Error");
        }
    }
private:
    UISwipeView* swipe_ { nullptr };
    UILabel* label_ { nullptr };
};
class MainAbilitySlice : public AbilitySlice {
protected:
    void OnStart(const Want &want) override;
    void OnStop() override;

private:
    RootView *rootView_ { nullptr };
    EventListener* backIconListener { nullptr };
    UIImageView* backIcon { nullptr };
    UILabel *label { nullptr };
    UILabel *label_title { nullptr };
    UILabel *label_remote_state { nullptr };
    UILabel *label_second { nullptr };
    UILabel *label_thrid { nullptr};
    UILabelButton *bt_connect {nullptr};
    UILabelButton *bt_disconnect { nullptr };
    UILabelButton *bt_left_one { nullptr };
    UILabelButton *bt_left_up { nullptr };
    UILabelButton *bt_up { nullptr };
    UILabelButton *bt_right_up { nullptr };
    UILabelButton *bt_right_one { nullptr };
    UILabelButton *bt_left_two { nullptr };
    UILabelButton *bt_left { nullptr };
    UILabelButton *bt_stop { nullptr };
    UILabelButton *bt_right { nullptr };
    UILabelButton *bt_right_two { nullptr };
    UILabelButton *bt_left_three { nullptr };
    UILabelButton *bt_left_down { nullptr };
    UILabelButton *bt_down { nullptr };
    UILabelButton *bt_right_down { nullptr };
    UILabelButton *bt_right_three { nullptr };
    GridLayout *gridlayout { nullptr };
    UISwipeView* swipe { nullptr };
    mySwipeListener* swipeListener { nullptr };
};

}

#endif // OHOS_MAIN_ABILITY_SLICE_H
